import Vue from 'vue';
import App from './App.vue';
import VueRouter from 'vue-router';
import   './js/base.js';
//require  './style/base.css'
//import router from './js/router.js'
//开启debug的模式
Vue.config.debug = true ;
window.Vue = Vue;
Vue.use(VueRouter);
Vue.component('listcon',require('./component/home/listcon.vue'));
Vue.component('goodsinfo',require('./component/detail/goodsinfo.vue'));
const router = new VueRouter({
    base: __dirname,
    routes: [{
        path: '/',
        redirect: '/home/1'
    }, {
        path: '/home', //自定义子路由
        component: require('./component/home.vue'),
        children:[
          {
            path:'/',
            redirect: '/home/1'
          },
          {
            path:'/home/1',
            component:require('./component/home/listTemplate.vue')
          },
          {
            path:'/home/:id',
            component:require('./component/home/list.vue')
          }
        ]
    }, {
        path: '/cart',
        component: require('./component/cart.vue')

    }, {
        path: '/order',
        component: require('./component/infinitescroll.vue')

    },
    {
        path: '/my',
        component: require('./component/my/personal.vue')

    },
    {
      path:'/detail/:id',
      component:require('./component/detail/detail.vue'),
      children:[
        {
          path:'/detail/:id/goodsinfor',
          component:require('./component/detail/goodsinfo.vue')
        },
        {
          path:'/detail/:id/goodsdescribe',
          component:require('./component/detail/goodsinfo.vue')
        }
      ]
    }
    ]
})

//创建一个app实例，并且挂载到app匹配的元素上
const app = new Vue({
    router: router,
    render: h => h(App)
}).$mount('#app')
